<?php

class TopicsController extends AppController {

	var $name = 'Topics';
	
	var $helpers = array('Html', 'Javascript', 'Ajax', 'Time');
	
	function view($topic_id = null) {
		if ($topic_id === null) {
			$this->redirect('/forums/');
		}
		$comments = $this->Topic->Comment->findAll('topic_id = ' . $topic_id, null, 'Comment.created ASC');
		$this->set('forum', $this->Topic->Forum->findById($comments[0]['Topic']['forum_id']));
		$this->set('comments', $comments);
	}

}

?>